<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>后台管理系统</title>
		<link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css"/>
		
	</head>
	<body>
	<div class="container" style="padding-top: 50px;">
		<div class="nav navbar-right" style="padding-right: 15px"><a href="../../index.html" class="btn btn-default logOut ">退出管理员</a></div>
		<ul id="myTab" class="nav nav-tabs">
			<li class="dropdown">
		<a href="#" id="myTabDrop1" class="dropdown-toggle"
		   data-toggle="dropdown">首页管理 
			<b class="caret"></b>
		</a>
		<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
			<li><a href="#home" tabindex="-1" data-toggle="tab">home</a></li>
			<li><a href="#ejb" tabindex="-1" data-toggle="tab">ejb</a></li>
		</ul>
	</li>
			<li class="dropdown">
		<a href="#" id="" class="dropdown-toggle"
		   data-toggle="dropdown">项目管理 
			<b class="caret"></b>
		</a>
		<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
			<li><a href="#pbReview" tabindex="-1" data-toggle="tab">项目审核认证</a></li>
			<li><a href="#createReview" tabindex="-1" data-toggle="tab">创业者认证审核</a></li>
		</ul>
	</li>
			<li class="dropdown">
		<a href="#" id="" class="dropdown-toggle"
		   data-toggle="dropdown">导师管理 
			<b class="caret"></b>
		</a>
		<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
			<li><a href="#daoshi_rengzheng" tabindex="-1" data-toggle="tab">导师认证</a></li>
			<li><a href="#daoshi_list" tabindex="-1" data-toggle="tab">导师列表</a></li>
		</ul>
	</li>
			<li class="dropdown">
		<a href="#" id="" class="dropdown-toggle"
		   data-toggle="dropdown">投资人机构 
			<b class="caret"></b>
		</a>
		<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
			<li><a href="#investmentReview" tabindex="-1" data-toggle="tab">投资人认证审核</a></li>
			<li><a href="#ejb" tabindex="-1" data-toggle="tab">ejb</a></li>
		</ul>
	</li>
			<li class="dropdown">
		<a href="#" id="" class="dropdown-toggle"
		   data-toggle="dropdown">用户管理 
			<b class="caret"></b>
		</a>
		<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
			<li><a href="#userList" tabindex="-1" data-toggle="tab">用户列表</a></li>
			<li><a href="#ejb" tabindex="-1" data-toggle="tab">ejb</a></li>
		</ul>
	</li>
			<li class="dropdown">
		<a href="#" id="" class="dropdown-toggle"
		   data-toggle="dropdown">需求审核 
			<b class="caret"></b>
		</a>
		<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
			<li><a href="#demandReview" tabindex="-1" data-toggle="tab">发布需求待审核</a></li>
			<li><a href="#resultsReview" tabindex="-1" data-toggle="tab">发布的成果待审核</a></li>
		</ul>
	</li>
		</ul>
		

		
		
		
		
	<div id="myTabContent" class="tab-content">
	<div class="tab-pane fade in active" id="home">
		
		<table class="table table-bordered">
			<thead>
				<tr>
					<th>名称</th>
					<th>城市</th>
					<th>邮编</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>Tanmay</td>
					<td>Bangalore</td>
					<td>560001</td>
				</tr>
				<tr>
					<td>Sachin</td>
					<td>Mumbai</td>
					<td>400003</td>
				</tr>
				<tr>
					<td>Uma</td>
					<td>Pune</td>
					<td>411027</td>
				</tr>
			</tbody>
		</table>
		
		
		
	</div>
	
	<!--项目认证-->
	<div class="tab-pane fade" id="pbReview">
			<table class="table table-bordered">
			<thead>
				<tr>
					<th>项目名称</th>
					<th>地区</th>
					<th>融资阶段</th>
					<th>创业领域</th>
					<th>成立时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				
			</tbody>
		</table>
		
		
		
		
		<ul class="pagination  pagination-lg pull-right" id="page">

	</ul>
	</div>
	
	
	<!--创业者认证-->
	<div class="tab-pane fade" id="createReview">
			<table class="table table-bordered">
			<thead>
				<tr>
					<th>真实姓名</th>
					<th>职位</th>
					<th>手机号码</th>
					<th>个人微信</th>
					<th>成立时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<!--<tr>
					<td>Tanmay</td>
					<td>Bangalore</td>
					<td>560001</td>
					<td>Tanmay</td>
					<td>Bangalore</td>
					<td class="text-center"><span style="margin-right: 20px;" creatId="" >通过</span><span>拒绝</span></td>
				</tr>-->
				
			</tbody>
		</table>
		
		
		
		
		<ul class="pagination  pagination-lg pull-right" >
		    <!--<li><a href="#">&laquo;</a></li>
		    <li class="active"><a href="#">1</a></li>
		    <li><a href="#">2</a></li>
		    <li><a href="#">3</a></li>
		    <li><a href="#">4</a></li>
		    <li><a href="#">5</a></li>
		    <li><a href="#">&raquo;</a></li>-->
		</ul>
	</div>
	
	
	<!--导师管理-->
	<div class="tab-pane fade" id="daoshi_rengzheng">
			<table class="table table-bordered">
			<thead>
				<tr>
					<th>姓名</th>
					<th>职称</th>
					<th>地区</th>
					<th>学历</th>
					<th>研究领域</th>
					<th>时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<!--<td>姓名</td>
					<td>职称</td>
					<td>地区</td>
					<td>学历</td>
					<td>研究领域</td>
					<td>时间</td>
					<td class="text-center"><span style="margin-right: 20px;" creatId="" >通过</span><span>拒绝</span></td>
				</tr>-->
				
			</tbody>
		</table>
		
		
		<ul class="pagination  pagination-lg pull-right" id="">
		   
		</ul>
	</div>
	
	<!--投资人审核认证-->
	<div class="tab-pane fade" id="investmentReview">
			<table class="table table-bordered">
			<thead>
				<tr>
					<th>姓名</th>
					<th>微信</th>
					<th>投资人身份</th>
					<th>投资领域</th>
					<th>偏好轮次</th>
					<th>时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<!--<td>姓名</td>
					<td>职称</td>
					<td>地区</td>
					<td>学历</td>
					<td>研究领域</td>
					<td>时间</td>
					<td class="text-center"><span style="margin-right: 20px;" creatId="" >通过</span><span>拒绝</span></td>
				</tr>-->
				
			</tbody>
		</table>
		
		
		<ul class="pagination  pagination-lg pull-right" id="investReview">
		   
		</ul>
	</div>
	
	
	<!--发布需求待审核-->
	<div class="tab-pane fade" id="demandReview">
			<table class="table table-bordered">
			<thead>
				<tr>
					<th>需求简介</th>
					<th>地区</th>
					<th>投资领域</th>
					<th>项目概述</th>
					<th>悬赏金额</th>
					<th>时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<!--<td>姓名</td>
					<td>职称</td>
					<td>地区</td>
					<td>学历</td>
					<td>研究领域</td>
					<td>时间</td>
					<td class="text-center"><span style="margin-right: 20px;" creatId="" >通过</span><span>拒绝</span></td>
				</tr>-->
				
			</tbody>
		</table>
		
		
		<ul class="pagination  pagination-lg pull-right">
		   
		</ul>
	</div>
	
	<!--发布成果待审核-->
	<div class="tab-pane fade" id="resultsReview">
			<table class="table table-bordered">
			<thead>
				<tr>
					<th>成果名称</th>
					<th>地区</th>
					<th>投资领域</th>
					<th>项目概述</th>
					<th>悬赏金额</th>
					<th>时间</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<!--<td>姓名</td>
					<td>职称</td>
					<td>地区</td>
					<td>学历</td>
					<td>研究领域</td>
					<td>时间</td>
					<td class="text-center"><span style="margin-right: 20px;" creatId="" >通过</span><span>拒绝</span></td>
				</tr>-->
				
			</tbody>
		</table>
		
		
		<ul class="pagination  pagination-lg pull-right" >
		   
		</ul>
	</div>
	
	
	<!--用户列表-->
	<div class="tab-pane fade" id="userList">
		<table class="table table-bordered">
			<thead>
			<tr>
				<th>用户id</th>
				<th>用户名</th>
				<th>导师权限</th>
				<th>投资者权限</th>
				<th>管理员权限</th>
				<th>技术需求者权限</th>
				<th>创业者权限</th>
			</tr>
			</thead>
			<tbody>
			<tr>
				<!--<td>姓名</td>
                <td>职称</td>
                <td>地区</td>
                <td>学历</td>
                <td>研究领域</td>
                <td>时间</td>
                <td class="text-center"><span style="margin-right: 20px;" creatId="" >通过</span><span>拒绝</span></td>
            </tr>-->

			</tbody>
		</table>


		<ul class="pagination  pagination-lg pull-right" >

		</ul>
	</div>
</div>
	</div>


	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel"> 权限管理</h4>
				</div>
				<div class="modal-body">
					确定撤销此权限？
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					<button type="button" class="btn btn-primary confirm">确认</button>
				</div>
			</div>
		</div>
	</div>
	</body>
	<script type="text/javascript" src="../../js/jquery-2.1.1.min.js" ></script>
	<script type="text/javascript" src="../../js/bootstrap.js" ></script>
	<script type="text/javascript" src="../../js/bootstrap-paginator.min.js" ></script>
	<script type="text/javascript">
	var userId = JSON.parse(sessionStorage.getItem("userId")).userid;
	console.log(userId)
	if (userId==''||userId==null){
	    window.location.href='denglu.html';
	}
	
	var totalNums = 0;
		
		//创业者待审核认证列表
	     getOrders(userId,1,10);
		function getOrders(opId,page,pageSize){
	    $.ajax({
			url:"http://114.112.96.184:18080/admin/auth/startups",
			type: "get", 
			data:{"userId":opId,"page":page,"size":pageSize,'status':0},
			dataType:"json",
			success: function(data){
				console.log(data);
				var html="";
				var length=0;
				var contact_times="";
				var pageHtml="";
				totalNums=data.result.totalElements;
				
				var pages=Math.ceil(data.result.totalElements/10);
		 		if(pages<1){
		 			$(".pagination").hide();
		 		}else{
		 			$(".pagination").show();
		 		}
		 		var options={
	            	bootstrapMajorVersion:3,  
	                currentPage:page,    //当前页数
	                numberOfPages:10,
	                totalPages:pages,    //所有数据可以显示的页数
	                tooltipTitles:function(){
	                },
	                itemTexts: function (type, page, current) {        
				        switch (type) {            
				        case "prev": return "←上一页";  
				        case "next": return "下一页→";            
				        case "page": return page;
				        }
	            },
	            shouldShowPage:function(type, page, current){
	                switch(type)
	                {
	                    case "first":
	                    case "last":
	                        return false;
	                    default:
	                        return true;
	                }
	            },
	            onPageClicked:function(event, originalEvent, type,page){
	            	console.log(page)
	            	getOrders(opId,page,pageSize)
	            }
	           }
		 		if(totalNums>0){
//		 			$(".pagination").bootstrapPaginator(options); 
		 		}
				var obj=data.result.content;
                	for (var i = 0; i < obj.length; i++) {
                		var creatTime=obj[i].createTime;
                		createTime=creatTime.substring(0,10);
                		var operate = '<span style="margin-right: 20px;" creatId="'+ obj[i].userId +'" creatType="1" >通过</span><span creatId="'+ obj[i].userId +'"  creatType="0">拒绝</span>';
                		var htmls=htmls+	 '<tr>'+
									 '<td>'+obj[i].realName +'</td>'+
									 '<td>'+ obj[i].dept +'</td>'+
									 '<td>'+ obj[i].mobile  +'</td>'+
									 '<td>'+ obj[i].weChat +'</td>'+
									 '<td>'+ createTime +'</td>'+
									 '<td class="text-center">'+ operate +'</td>'+
								 '</tr>'
                	}
                 $('#createReview tbody').html(htmls);
	            
			}, //操作成功后的操作！msg是后台传过来的值
			error:function(msg){
				console.log(msg);
			}
		});
	}
		
		$('#createReview').on('click','span',function(){
			var that = $(this);
			var creatId = $(this).attr('creatId');
			var creatType = $(this).attr('creatType');
			var urls ="http://114.112.96.184:18080/admin/auth/startup/"+creatId ;
				$.ajax({
                type: "put",
                data:{'userId':userId,'code':creatType},
                url:urls,
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                  that.parent().parent().remove()
                  
                }
            });
		})
		
		//项目待审核列表
		getOrders_pb(userId,1,10);
		function getOrders_pb(opId,page,pageSize){
	    $.ajax({
			url:"http://114.112.96.184:18080/admin/auth/pbs",
			type: "get", 
			data:{"userId":opId,"index":page,"size":pageSize,'status':0},
			dataType:"json",
			success: function(data){
				console.log(data);
				var html="";
				var length=0;
				var contact_times="";
				var pageHtml="";
				totalNums=data.result.totalElements;
				
				var pages=Math.ceil(data.result.totalElements/10);
		 		if(pages<1){
		 			$(".pagination").hide();
		 		}else{
		 			$(".pagination").show();
		 		}
		 		var options={
	            	bootstrapMajorVersion:3,  
	                currentPage:page,    //当前页数
	                numberOfPages:10,
	                totalPages:pages,    //所有数据可以显示的页数
	                tooltipTitles:function(){
	                },
	                itemTexts: function (type, page, current) {        
				        switch (type) {            
				        case "prev": return "←上一页";  
				        case "next": return "下一页→";            
				        case "page": return page;
				        }
	            },
	            shouldShowPage:function(type, page, current){
	                switch(type)
	                {
	                    case "first":
	                    case "last":
	                        return false;
	                    default:
	                        return true;
	                }
	            },
	            onPageClicked:function(event, originalEvent, type,page){
	            	console.log(page)
	            	getOrders_pb(opId,page,pageSize)
	            }
	           }
		 		if(totalNums>0){
		 			$("#pbReview .pagination").bootstrapPaginator(options); 
		 		}
				var obj=data.result.content;
                	for (var i = 0; i < obj.length; i++) {
                		var creatTime=obj[i].createTime;
                		createTime=creatTime.substring(0,10);
                		var operate = '<span style="margin-right: 20px;" creatId="'+ obj[i].id +'" creatType="1" >通过</span><span creatId="'+ obj[i].id +'"  creatType="0">拒绝</span>';
                		var htmls=htmls+	 '<tr>'+
									 '<td>'+obj[i].pbName +'</td>'+
									 '<td>'+ obj[i].area +'</td>'+
									 '<td>'+ obj[i].stage  +'</td>'+
									 '<td>'+ obj[i].field +'</td>'+
									 '<td>'+ createTime +'</td>'+
									 '<td class="text-center">'+ operate +'</td>'+
								 '</tr>'
                	}
                 $('#pbReview tbody').html(htmls);
	            
			}, //操作成功后的操作！msg是后台传过来的值
			error:function(msg){
				console.log(msg);
			}
		});
	}
		
		$('#pbReview').on('click','span',function(){
			var that = $(this);
			var creatId = $(this).attr('creatId');
			var creatType = $(this).attr('creatType');
			var urls ="http://114.112.96.184:18080/admin/pb/"+creatId ;
				$.ajax({
                type: "put",
                data:{'userId':userId,'code':creatType},
                url:urls,
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                  that.parent().parent().remove()
                  
                }
            });
		})
		
		
		
		
		//导师认证审核列表
		getOrders_tutor(userId,1,10);
		function getOrders_tutor(opId,page,pageSize){
	    $.ajax({
			url:"http://114.112.96.184:18080/admin/auth/tutors",
			type: "get", 
			data:{"userId":opId,"index":page,"size":pageSize,'status':0},
			dataType:"json",
			success: function(data){
				console.log(data);
				var html="";
				var length=0;
				var contact_times="";
				var pageHtml="";
				totalNums=data.result.totalElements;

				var pages=Math.ceil(data.result.totalElements/10);
		 		if(pages<1){
		 			$(".pagination").hide();
		 		}else{
		 			$(".pagination").show();
		 		}
		 		var options={
	            	bootstrapMajorVersion:3,  
	                currentPage:page,    //当前页数
	                numberOfPages:10,
	                totalPages:pages,    //所有数据可以显示的页数
	                tooltipTitles:function(){
	                },
	                itemTexts: function (type, page, current) {        
				        switch (type) {            
				        case "prev": return "←上一页";  
				        case "next": return "下一页→";            
				        case "page": return page;
				        }
	            },
	            shouldShowPage:function(type, page, current){
	                switch(type)
	                {
	                    case "first":
	                    case "last":
	                        return false;
	                    default:
	                        return true;
	                }
	            },
	            onPageClicked:function(event, originalEvent, type,page){
	            	console.log(page)
	            	getOrders_tutor(opId,page,pageSize)
	            }
	           }
		 		if(totalNums>0){
		 			$("#daoshi_rengzheng .pagination").bootstrapPaginator(options); 
		 		}
				var obj=data.result.content;
                	for (var i = 0; i < obj.length; i++) {
                		var creatTime=obj[i].createTime;
                		createTime=creatTime.substring(0,10);
                		var operate = '<span style="margin-right: 20px;" creatId="'+ obj[i].id +'" creatType="1" >通过</span><span creatId="'+ obj[i].id +'"  creatType="0">拒绝</span>';
                		var htmls=htmls+	 '<tr>'+
									 '<td>'+obj[i].realName +'</td>'+
									 '<td>'+ obj[i].title +'</td>'+
									 '<td>'+ obj[i].area  +'</td>'+
									 '<td>'+ obj[i].education +'</td>'+
									 '<td>'+ obj[i].researchField +'</td>'+
									 '<td>'+ createTime +'</td>'+
									 '<td class="text-center">'+ operate +'</td>'+
								 '</tr>'
                	}
                 $('#daoshi_rengzheng tbody').html(htmls);
	            
			}, //操作成功后的操作！msg是后台传过来的值
			error:function(msg){
				console.log(msg);
			}
		});
	}
		
		$('#daoshi_rengzheng').on('click','span',function(){
			var that =$(this)
			var creatId = $(this).attr('creatId');
			var creatType = $(this).attr('creatType');
			var urls ="http://114.112.96.184:18080/admin/auth/tutor/"+creatId ;
				$.ajax({
                type: "put",
                data:{'userId':userId,'code':creatType},
                url:urls,
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                  that.parent().parent().remove()
                }
            });
            
		})

		
		
		
		//投资人认证审核列表
		getOrders_investment(userId,1,10);
		function getOrders_investment(opId,page,pageSize){
	    $.ajax({
			url:"http://114.112.96.184:18080/admin/auth/invests",
			type: "get", 
			data:{"userId":opId,"index":page,"size":pageSize,'status':0},
			dataType:"json",
			success: function(data){
				console.log(data);
				var html="";
				var length=0;
				var contact_times="";
				var pageHtml="";
				totalNums=data.result.totalElements;
				var pages=Math.ceil(data.result.totalElements/10);
		 		if(pages<1){
		 			$("#investReview").hide();
		 		}else{
		 			$("#investReview").show();
		 		}
		 		var options={
	            	bootstrapMajorVersion:3,  
	                currentPage:page,    //当前页数
	                numberOfPages:10,
	                totalPages:pages,    //所有数据可以显示的页数
	                tooltipTitles:function(){
	                },
	                itemTexts: function (type, page, current) {        
				        switch (type) {            
				        case "prev": return "←上一页";  
				        case "next": return "下一页→";            
				        case "page": return page;
				        }
	            },
	            shouldShowPage:function(type, page, current){
	                switch(type)
	                {
	                    case "first":
	                    case "last":
	                        return false;
	                    default:
	                        return true;
	                }
	            },
	            onPageClicked:function(event, originalEvent, type,page){
	            	console.log(page)
					debugger;
					getOrders_investment(opId,page,pageSize)
	            }
	           }
		 		if(totalNums>0){
		 			$('#investReview').bootstrapPaginator(options);
		 		}
				var obj=data.result.content;
                	for (var i = 0; i < obj.length; i++) {
                		var creatTime=obj[i].createTime;
                		createTime=creatTime.substring(0,10);
                		var operate = '<span style="margin-right: 20px;" creatId="'+ obj[i].userId +'" creatType="1" >通过</span><span creatId="'+ obj[i].userId +'"  creatType="0">拒绝</span>';
                		var htmls=	htmls+ '<tr>'+
									 '<td>'+obj[i].realName +'</td>'+
									 '<td>'+ obj[i].weChat +'</td>'+
									 '<td>'+ obj[i].identity  +'</td>'+
									 '<td>'+ obj[i].field +'</td>'+
									 '<td>'+ obj[i].preference +'</td>'+
									 '<td>'+ createTime +'</td>'+
									 '<td class="text-center">'+ operate +'</td>'+
								 '</tr>'
                	}
                 $('#investmentReview tbody').html(htmls);
	            
			}, //操作成功后的操作！msg是后台传过来的值
			error:function(msg){
				console.log(msg);
			}
		});
	}

		$('#investmentReview').on('click','span',function(){
			var that =$(this)
			var creatId = $(this).attr('creatId');
			var creatType = $(this).attr('creatType');
			var urls ="http://114.112.96.184:18080/admin/auth/invest/"+creatId ;
				$.ajax({
                type: "put",
                data:{'userId':userId,'code':creatType},
                url:urls,
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                  that.parent().parent().remove()
                }
            });
            
		})

		
		
		
		//发布需求待审核列表
		getOrders_demand(userId,1,10);
		function getOrders_demand(opId,page,pageSize){
	    $.ajax({
			url:"http://114.112.96.184:18080/admin/auth/demands",
			type: "get", 
			data:{"userId":opId,"index":page,"size":pageSize,'status':0},
			dataType:"json",
			success: function(data){
				console.log(data);
				var html="";
				var length=0;
				var contact_times="";
				var pageHtml="";
				totalNums=data.result.totalElements;
				
				var pages=Math.ceil(data.result.totalElements/10);
		 		if(pages<1){
		 			$("#demandReview .pagination").hide();
		 		}else{
		 			$("#demandReview .pagination").show();
		 		}
		 		var options={
	            	bootstrapMajorVersion:3,  
	                currentPage:page,    //当前页数
	                numberOfPages:10,
	                totalPages:pages,    //所有数据可以显示的页数
	                tooltipTitles:function(){
	                },
	                itemTexts: function (type, page, current) {        
				        switch (type) {            
				        case "prev": return "←上一页";  
				        case "next": return "下一页→";            
				        case "page": return page;
				        }
	            },
	            shouldShowPage:function(type, page, current){
	                switch(type)
	                {
	                    case "first":
	                    case "last":
	                        return false;
	                    default:
	                        return true;
	                }
	            },
	            onPageClicked:function(event, originalEvent, type,page){
	            	console.log(page)
	            	getOrders_demand(opId,page,pageSize)
	            }
	           }
		 		if(totalNums>0){
		 			$("#demandReview .pagination").bootstrapPaginator(options); 
		 		}
				var obj=data.result.content;
			
                	for (var i = 0; i < obj.length; i++) {
                		var creatTime=obj[i].createTime;
                		createTime=creatTime.substring(0,10);
                		var operate = '<span style="margin-right: 20px;" creatId="'+ obj[i].id +'" creatType="1" >通过</span><span creatId="'+ obj[i].id +'"  creatType="0">拒绝</span>';
                		var htmls = htmls + '<tr>'+
									 '<td>'+obj[i].demandProfile +'</td>'+
									 '<td>'+ obj[i].area +'</td>'+
									 '<td>'+ obj[i].field  +'</td>'+
									 '<td>'+ obj[i].overview +'</td>'+
									 '<td>'+ obj[i].price +'</td>'+
									 '<td>'+ createTime +'</td>'+
									 '<td class="text-center">'+ operate +'</td>'+
								 '</tr>'
						
			
                	}
               
                 $('#demandReview tbody').html(htmls);
	            
			}, //操作成功后的操作！msg是后台传过来的值
			error:function(msg){
				console.log(msg);
			}
		});
	}

		$('#demandReview').on('click','span',function(){
			var that =$(this)
			var creatId = $(this).attr('creatId');
			var creatType = $(this).attr('creatType');

			var urls ="http://114.112.96.184:18080/admin/demand/"+creatId ;
				$.ajax({
                type: "put",
                data:{'userId':userId,'code':creatType},
                url:urls,
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                  that.parent().parent().remove()
                }
            });
            
		})

		
		//发布成果待审核列表
		getOrders_results(userId,1,10);
		function getOrders_results(opId,page,pageSize){
	    $.ajax({
			url:"http://114.112.96.184:18080/admin/auth/achievements",
			type: "get", 
			data:{"userId":opId,"index":page,"size":pageSize,'status':0},
			dataType:"json",
			success: function(data){
				console.log(data);
				var html="";
				var length=0;
				var contact_times="";
				var pageHtml="";
				totalNums=data.result.totalElements;
				
				var pages=Math.ceil(totalNums/10);
				
		 		if(pages<=1){
		 			$("#resultsReview .pagination").hide();
		 		}else{
		 			$("#resultsReview .pagination").show();
		 		}
		 		
		 		var options={
	            	bootstrapMajorVersion:3,  
	                currentPage:page,    //当前页数
	                numberOfPages:10,
	                totalPages:pages,    //所有数据可以显示的页数
	                tooltipTitles:function(){
	                },
	                itemTexts: function (type, page, current) {        
				        switch (type) {            
				        case "prev": return "←上一页";  
				        case "next": return "下一页→";            
				        case "page": return page;
				        }
	            },
	            shouldShowPage:function(type, page, current){
	                switch(type)
	                {
	                    case "first":
	                    case "last":
	                        return false;
	                    default:
	                        return true;
	                }
	            },
	            onPageClicked:function(event, originalEvent, type,page){
	            	console.log(page)
	            	getOrders_results(opId,page,pageSize)
	            }
	           }
		 		if(totalNums>0){
		 			$("#resultsReview .pagination").bootstrapPaginator(options); 
		 		}
				var obj=data.result.content;
                	for (var i = 0; i < obj.length; i++) {
                		var creatTime=obj[i].createTime;
                		createTime=creatTime.substring(0,10);
                		var operate = '<span style="margin-right: 20px;" creatId="'+ obj[i].id +'" creatType="1" >通过</span><span creatId="'+ obj[i].id +'"  creatType="0">拒绝</span>';
                		var htmls=htmls	+ '<tr>'+
									 '<td>'+obj[i].achievementName +'</td>'+
									 '<td>'+ obj[i].area +'</td>'+
									 '<td>'+ obj[i].field  +'</td>'+
									 '<td>'+ obj[i].overview +'</td>'+
									 '<td>'+ obj[i].price +'</td>'+
									 '<td>'+ createTime +'</td>'+
									 '<td class="text-center">'+ operate +'</td>'+
								 '</tr>'
                	}
                 $('#resultsReview tbody').html(htmls);
	            
			}, //操作成功后的操作！msg是后台传过来的值
			error:function(msg){
				console.log(msg);
			}
		});
	}

		$('#resultsReview').on('click','span',function(){
			var that =$(this)
			var creatId = $(this).attr('creatId');
			var creatType = $(this).attr('creatType');

			var urls ="http://114.112.96.184:18080/admin/achievement/"+creatId ;
				$.ajax({
                type: "put",
                data:{'userId':userId,'code':creatType},
                url:urls,
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                  that.parent().parent().remove()
                }
            });
            
		})


		//用户列表
		getOrders_user(userId,1,10);
		function getOrders_user(opId,page,pageSize){
			$.ajax({
				url:"http://114.112.96.184:18080/sys/users",
				type: "get",
				data:{"userId":opId,"index":page,"size":pageSize},
				dataType:"json",
				success: function(data){
					console.log(data);
					var html="";
					var length=0;
					var contact_times="";
					var pageHtml="";
					totalNums=data.result.totalElements;

					var pages=Math.ceil(totalNums/10);

					if(pages<=1){
						$(".pagination").hide();
					}else{
						$(".pagination").show();
					}

					var options={
						bootstrapMajorVersion:3,
						currentPage:page,    //当前页数
						numberOfPages:10,
						totalPages:pages,    //所有数据可以显示的页数
						tooltipTitles:function(){
						},
						itemTexts: function (type, page, current) {
							switch (type) {
								case "prev": return "←上一页";
								case "next": return "下一页→";
								case "page": return page;
							}
						},
						shouldShowPage:function(type, page, current){
							switch(type)
							{
								case "first":
								case "last":
									return false;
								default:
									return true;
							}
						},
						onPageClicked:function(event, originalEvent, type,page){
							console.log(page)
                            getOrders_user(opId,page,pageSize)
						}
					}
					if(totalNums>0){
						$("#userList .pagination").bootstrapPaginator(options);
					}
					var obj=data.result.content;
					for (var i = 0; i < obj.length; i++) {
						var htmls=htmls	+ '<tr ids="'+obj[i].id+'">'+
							'<td>'+obj[i].id +'</td>'+
							'<td>'+ obj[i].username +'</td>'+
							'<td data-toggle="modal" type="tutorAuthority" >'+ obj[i].tutor  +'</td>'+
							'<td data-toggle="modal" type="investAuthority">'+ obj[i].invest +'</td>'+
							'<td>'+ obj[i].admin +'</td>'+
							'<td data-toggle="modal" type="technicalAuthority">'+ obj[i].technical +'</td>'+
							'<td data-toggle="modal" type="startupAuthority">'+obj[i].startup+'</td>'+
							'</tr>'
					}
					$('#userList tbody').html(htmls);

				}, //操作成功后的操作！msg是后台传过来的值
				error:function(msg){
					console.log(msg);
				}
			});
		}

		$('.logOut').on('click',function () {
			sessionStorage.clear();
        })

		$('#userList tbody').on('click','td',function () {
//			$('#myModal').modal('show')
			var type =$(this).attr('type');
			var id = $(this).parent().attr('ids')
			debugger;
		})
		//创业者待审核认证列表
//		$.ajax({
//              type: "get",
//              data:{"userId":userId},
//              url:"http://114.112.96.184:18080/admin/auth/startups",
//              async: false,
//              error: function(request) {
//                  alert("Connection error");
//              },
//              success: function(data) {
//              	console.log(data)
//              	var obj=data.result.content;
//              	for (var i = 0; i < obj.length; i++) {
//              		var creatTime=obj[i].createTime;
//              		createTime=creatTime.substring(0,10);
//              		var operate = '<span style="margin-right: 20px;" creatId="'+ obj[i].userId +'" creatType="y" >通过</span><span creatId="'+ obj[i].userId +'"  creatType="n">拒绝</span>';
//              		var htmls=	 '<tr>'+
//									 '<td>'+obj[i].realName +'</td>'+
//									 '<td>'+ obj[i].dept +'</td>'+
//									 '<td>'+ obj[i].mobile  +'</td>'+
//									 '<td>'+ obj[i].weChat +'</td>'+
//									 '<td>'+ createTime +'</td>'+
//									 '<td class="text-center">'+ operate +'</td>'+
//								 '</tr>'
//              	}
//               $('#createReview tbody').html(htmls);
//              }
//          });


		//认证导师列表
	</script>
</html>
